import axios from 'axios';

const BASE_API_URL = 'http://localhost:8080/';

const CAMERA_API_URL = 'http://192.168.2.57/easy-api';
const WEBRTC_STREAM_URL = 'http://192.168.2.57/webrtc-api';

const service = axios.create({
    baseURL: BASE_API_URL,
    timeout: 10000,
});

const cameraService = axios.create({
    baseURL: CAMERA_API_URL,
    timeout: 10000,
});

cameraService.interceptors.request.use(
    config => {
        config.headers['Authorization'] = 'Basic YWRtaW4xMjM6QWRtaW5AMTIz'; // [cite: 15]
        return config;
    },
    error => {
        console.log("camera error in interceptor",error);
        return Promise.reject(error);
    }
);

export { service, cameraService, WEBRTC_STREAM_URL };